import { VNodeChildren } from 'vue'
import { createTypes, VueTypeValidableDef, VueTypesInterface } from 'vue-types'
import { CSSProperties } from '/#/extendVue'

export type VueNode = VNodeChildren | JSX.Element

type PropTypes = VueTypesInterface & {
  readonly style: VueTypeValidableDef<CSSProperties>
  readonly VNodeChild: VueTypeValidableDef<VueNode>
  // readonly trueBool: VueTypeValidableDef<boolean>;
}

const propTypes = createTypes({
  func: undefined,
  bool: undefined,
  string: undefined,
  number: undefined,
  object: undefined,
  integer: undefined,
}) as PropTypes
// TODO 这里报警告 [VueTypes warn]: VueTypes.extend is deprecated. Use the ES6+ method instead.
// propTypes.extend([
//   // {
//   //   name: 'style',
//   //   getter: true,
//   //   type: [String, Object],
//   //   default: undefined,
//   // },
//   {
//     name: 'VNodeChild',
//     getter: true,
//     type: undefined,
//   },
// ]);

// 报错 [VueTypes warn]: VueTypes.extend is deprecated. Use the ES6+ method instead.
// 文章参考 https://dwightjack.github.io/vue-types/advanced/extending-vue-types.html#extending-namespaced-validators-in-es6
class ProjectTypes extends propTypes {
  // a native-like validator that supports the `.validable` method
  VNodeChild() {
    return {
      name: 'VNodeChild',
      getter: true,
      type: undefined,
    }
  }
}

export { ProjectTypes as propTypes }
